var url=require('url');

module.exports = function (req, res, next) {
    //var reqUrl = req.url.split('?')[0];
    var result=url.parse(req.url);
    if(result.pathname=='/user/login' || result.pathname=='/user/add'){
        next();
    }else {
        console.log('req.session.user=============='+req.session.user);
        if(req.session.user){
            next();
        }else{
            res.redirect('/user/login');
        }

    }
};